UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DcP/LiNDWWTqld6nmaDtb1cXw+K7ev8hKmWB/7RHkPc=' 
WHERE 
  key_id = 'e40fab820b5cb123e0b996a94a853aed2bbca36a0c334fb9423ad09f120023f3' 
  AND (
    token = 'DcP/LiNDWWTqld6nmaDtb1cXw+K7ev8hKmWB/7RHkPc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037