UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b42GgqtCI+07oH8cy5KbuWEYy6orofMvoPDMhuS3P7g=' 
WHERE 
  key_id = '5bf3783aa0bea9fa4315eaffa8af9e27e5e7706bb61bc31afa1d9a16826e77ce' 
  AND (
    token = 'b42GgqtCI+07oH8cy5KbuWEYy6orofMvoPDMhuS3P7g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026