UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2L3J5alnRkfRCuq0YwF0pjSvwPZs0DbO6zS5vsNrnUo=' 
WHERE 
  key_id = '17a8d6cb12c76f18491cafb1eeea86a1ad58b8798f1fa11681f1dfb8e20fcd51' 
  AND (
    token = '2L3J5alnRkfRCuq0YwF0pjSvwPZs0DbO6zS5vsNrnUo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043