UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Kbtwzlhg+jK4Tnb/kaoPparyemBxpCM+s6QL3XtvK20=' 
WHERE 
  key_id = '3bc042db3b6719f4c18e000712b23074b9d81916ad577bc38015dcaf6ae3b1f3' 
  AND (
    token = 'Kbtwzlhg+jK4Tnb/kaoPparyemBxpCM+s6QL3XtvK20=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041