UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '04tuYdB/bbOVGpRP+WoenunW3HK87w9K97zqJ7peXmY=' 
WHERE 
  key_id = '79a1ab2f2bfe14da9f2f132c4013879a1deb703364f51375b5246b55ff5e3d30' 
  AND (
    token = '04tuYdB/bbOVGpRP+WoenunW3HK87w9K97zqJ7peXmY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022