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

Query time 0.00042