UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Wx4jYGzwmuyvlOFvNMXfc5rObn13bMmFvZD3pCfs8vg=' 
WHERE 
  key_id = 'fede87b67fb9e16e0f15de7909fb8ebc52af642be339375f35e8e4046fed7ec6' 
  AND (
    token = 'Wx4jYGzwmuyvlOFvNMXfc5rObn13bMmFvZD3pCfs8vg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035