UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'toDy+aqriakzc0gOYkTRzuidH0F9D6IjqFtQ4AcRs98=' 
WHERE 
  key_id = '7495132cf344a61d01974ea973641e5a9a80c30797f603f8d5fc2ffcf7eae056' 
  AND (
    token = 'toDy+aqriakzc0gOYkTRzuidH0F9D6IjqFtQ4AcRs98=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024