UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UEIeM0au6rf+B9YYWe9uEaby9e44HBEoIyZRlRLDbC0=' 
WHERE 
  key_id = '0d90469c45fb6434acd19122e0cf7d940a53c1a29fb0cca3082769a207c1b387' 
  AND (
    token = 'UEIeM0au6rf+B9YYWe9uEaby9e44HBEoIyZRlRLDbC0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034