UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jP5YN2h07zdDzDDaag6iYuJG6undJOOo43UBkqmEKlM=' 
WHERE 
  key_id = 'd15d3cde26fbfcfcb9d7bcbcba03d44ac55e2e7416b1fbf4071bcebe2a121c7c' 
  AND (
    token = 'jP5YN2h07zdDzDDaag6iYuJG6undJOOo43UBkqmEKlM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037