UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Dkf4QQJTbS2iTfa4+gQM1P7t6ftOOpEVMpEglxfnJ10=' 
WHERE 
  key_id = '157a1f3241c65ac009ba6485413a072a52ed46c6139dcb60d6bc91ac3839107d' 
  AND (
    token = 'Dkf4QQJTbS2iTfa4+gQM1P7t6ftOOpEVMpEglxfnJ10=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036