UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JtgwtO7OgwDcRK5vqZ+t4rRbT3l89lyKWPAV+Z4rMJ0=' 
WHERE 
  key_id = '0a4f2f1e68606298eaf134d37c28b28c0275a1f1ccb5642d31ead622727022c0' 
  AND (
    token = 'JtgwtO7OgwDcRK5vqZ+t4rRbT3l89lyKWPAV+Z4rMJ0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044