UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e2guyDiorkIsSZL6E6kpSNz+f3+6OA406QEV4ZAGvk0=' 
WHERE 
  key_id = '3bd40abce7de853831469371b08a4ef3ba4bdb78a0e5d2cb37d2d8f1b87fb10e' 
  AND (
    token = 'e2guyDiorkIsSZL6E6kpSNz+f3+6OA406QEV4ZAGvk0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026