UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kYEn/hlUQxkE88OMsDcv5uUtKjsrDYsXyIZnxK+GRpM=' 
WHERE 
  key_id = 'bc0fddeb3c4b37c9a4469cc6331e515f8fae691144986f4c42a6b152383b08ad' 
  AND (
    token = 'kYEn/hlUQxkE88OMsDcv5uUtKjsrDYsXyIZnxK+GRpM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050