UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Co4RbdQJL3J/XFeT4BIaclx2Masn33lHzcgAs1iC+eA=' 
WHERE 
  key_id = 'fb499906ffda2bcf56a93ef48c473a828e5f012ae519a2d2950beb693786f0e5' 
  AND (
    token = 'Co4RbdQJL3J/XFeT4BIaclx2Masn33lHzcgAs1iC+eA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035