UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'D0QeDAJkO4BvE3Yn1JAszCntveMhRWN366fOduQnsh4=' 
WHERE 
  key_id = '4909d34cdef258056cbac75dcf4b776c298ff79f9a5a2ee99109d8a5dd5dc2f2' 
  AND (
    token = 'D0QeDAJkO4BvE3Yn1JAszCntveMhRWN366fOduQnsh4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027