UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4tgL/4Fd+Y5SUfaS7ty2OsLQkKBRu+wsvKSxptM4p+Y=' 
WHERE 
  key_id = '62a0c7ebad1d0843bdecad5209e1e51b225b31324d780fcf5e4e206edf20b275' 
  AND (
    token = '4tgL/4Fd+Y5SUfaS7ty2OsLQkKBRu+wsvKSxptM4p+Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055