UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bY1UMwkkoZeths4hYs2SzqSGw7JPwme98xynJuDGFXg=' 
WHERE 
  key_id = '20bc9a4bf92572c9c7f844b6506f3299e9c36816fa278987bbcb7f56500e7887' 
  AND (
    token = 'bY1UMwkkoZeths4hYs2SzqSGw7JPwme98xynJuDGFXg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027