UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'u6hXpG252BAdax42kOsTR1bDb5gtpKBADFcv7xkw6lE=' 
WHERE 
  key_id = '30327904f1514520cf56715bd39602d9ffbb79fbc23a7f5f3206363127edc223' 
  AND (
    token = 'u6hXpG252BAdax42kOsTR1bDb5gtpKBADFcv7xkw6lE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033