UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm0fAcD6cpsnv1G5ZUt5jAZ2D1EXBcICt6IZOG1ZHN1U=' 
WHERE 
  key_id = '5d928f7ca83fe7ce22b607bf5c793f5270240dd240c0ace068eebdc4fc896546' 
  AND (
    token = 'm0fAcD6cpsnv1G5ZUt5jAZ2D1EXBcICt6IZOG1ZHN1U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027