UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0mheCRzswJO6PK8lz1+RO11OSeQH39SxdIRGW75kVJI=' 
WHERE 
  key_id = '14ba0e716cd0edb31609d0d1e9084601214505185462fbdc08604afb74ae153e' 
  AND (
    token = '0mheCRzswJO6PK8lz1+RO11OSeQH39SxdIRGW75kVJI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029