UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6oJcDeeRWHBqZQcxDufLnJKYGLOCbQb3lvENsYUvjGQ=' 
WHERE 
  key_id = '1817e522209331fb848b448e9914d6b4763ff98ce2b4e92161bc8d96eeebd8d2' 
  AND (
    token = '6oJcDeeRWHBqZQcxDufLnJKYGLOCbQb3lvENsYUvjGQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029