UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9GjUd6bKm9zP169rIOz/JK8T+KygysqglnN9pInDV24=' 
WHERE 
  key_id = '518b0b48f03c4b2d595e6c9dd44053c142154bb7f0f94ee13568a2d15469c3f7' 
  AND (
    token = '9GjUd6bKm9zP169rIOz/JK8T+KygysqglnN9pInDV24=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028