UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LhEuOlQVejCU2N7xwI/hLX1GVblfBXOmeYNRVlK1y6E=' 
WHERE 
  key_id = 'e223a98027932abf2f530a697d49a0d5998d0f721bde3e435f748e7910b32915' 
  AND (
    token = 'LhEuOlQVejCU2N7xwI/hLX1GVblfBXOmeYNRVlK1y6E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033