UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SJ9lt+2DfXgeUXzesqwETesFb6Zj+Tald82zZhKvEyk=' 
WHERE 
  key_id = '2cb71abb685f87d4258bddd0de8e12862d72016d614e1a0f9fa1428b5da0ba2d' 
  AND (
    token = 'SJ9lt+2DfXgeUXzesqwETesFb6Zj+Tald82zZhKvEyk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032