UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tsgyzbLVdg/wOUb8h0+egc2jt4p+MJKN9lcffNUha9A=' 
WHERE 
  key_id = '461931f488d864c9181dea75f42880169a26596e6b1e3d90affbbadfd404c04e' 
  AND (
    token = 'tsgyzbLVdg/wOUb8h0+egc2jt4p+MJKN9lcffNUha9A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043