UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uvVUes6EtYwvBpYN+Z8F6004Cm0qLH0Qfbp2CXcsYOE=' 
WHERE 
  key_id = '3402a7a19ab94cad9d62618501257b4cf9104b6fa0183176a8bfd672230b5620' 
  AND (
    token = 'uvVUes6EtYwvBpYN+Z8F6004Cm0qLH0Qfbp2CXcsYOE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028