UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZQeGO0K77aAdN733NnzrH3tcmd6I3JOtXHEnpPGcuAg=' 
WHERE 
  key_id = '7af8f89e2bec523a0e662d9354206f31f1867a823f186eadcba3048a1a1f8a7d' 
  AND (
    token = 'ZQeGO0K77aAdN733NnzrH3tcmd6I3JOtXHEnpPGcuAg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041