UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jeJ6ds1r1SmODC3z+jDo08gjexLCBsEhxj6uCfQf3Ho=' 
WHERE 
  key_id = '435aadbee0065ca232c104bb79c09b8d90a81a8b7a5772a6a343781bc5c17086' 
  AND (
    token = 'jeJ6ds1r1SmODC3z+jDo08gjexLCBsEhxj6uCfQf3Ho=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052