UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gGKjD7uL5QawDaHglKJtQuX/OkAvPfDtY7BWZkHvID8=' 
WHERE 
  key_id = 'cb79331bbea23218f63c1289d309608ce300184c3858072b425ccdc4db58cde2' 
  AND (
    token = 'gGKjD7uL5QawDaHglKJtQuX/OkAvPfDtY7BWZkHvID8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041