UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Eq+fwtlf4RigITxDnNn8JOj8m/XVkjA6JvpXmTF50Io=' 
WHERE 
  key_id = '95f040e3e5623375df2b788d1818f09ac708801ccb264bfde969d2e8c1f21a28' 
  AND (
    token = 'Eq+fwtlf4RigITxDnNn8JOj8m/XVkjA6JvpXmTF50Io=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035