UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RWF2Uyth+VFLVZmXrSeIGlrtd2Es8aEVS+DkCxuHGTI=' 
WHERE 
  key_id = '2807d7230fb596cb3a756fdcd0726656f59a839c6066abf3e23a7532012cb473' 
  AND (
    token = 'RWF2Uyth+VFLVZmXrSeIGlrtd2Es8aEVS+DkCxuHGTI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047