UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tALqwvL49Y02yqjHx+6y4AwnJXRIHtdBaC/QoobcaXE=' 
WHERE 
  key_id = '51d35dff07d881519ee5738b87ccbecc942015d034572c97f69e8d44a05280c0' 
  AND (
    token = 'tALqwvL49Y02yqjHx+6y4AwnJXRIHtdBaC/QoobcaXE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048