UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'R3pqDlwU5QuLnZ0ROWPwGDvw0DNpr9yDh06Pwde20Cw=' 
WHERE 
  key_id = '9667d7a831bc61cfa2c9d8199cb72dc5183610d3b687518cc1f92aa0ecbca35b' 
  AND (
    token = 'R3pqDlwU5QuLnZ0ROWPwGDvw0DNpr9yDh06Pwde20Cw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028